package pe.gob.onpe.ejb;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Ubigeo entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "UBIGEO", schema = "SVENP", uniqueConstraints = {})
public class Ubigeo implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = -719706777324827236L;
	
	private String ubigeo;
	private Ubigeo ubigeoPadre;
	private String descripcion;
	private Set<RegistroLinea> registroLineas = new HashSet<RegistroLinea>(0);
	private Set<PadronElectoralOnpe> padronElectoralOnpes = new HashSet<PadronElectoralOnpe>(
			0);
	private Set<Ubigeo> ubigeos = new HashSet<Ubigeo>(0);

	// Constructors

	/** default constructor */
	public Ubigeo() {
	}

	/** minimal constructor */
	public Ubigeo(String ubigeo) {
		this.ubigeo = ubigeo;
	}

	/** full constructor */
	public Ubigeo(String ubigeo, Ubigeo ubigeoPadre, String descripcion,
			Set<RegistroLinea> registroLineas,
			Set<PadronElectoralOnpe> padronElectoralOnpes, Set<Ubigeo> ubigeos) {
		this.ubigeo = ubigeo;
		this.ubigeoPadre = ubigeoPadre;
		this.descripcion = descripcion;
		this.registroLineas = registroLineas;
		this.padronElectoralOnpes = padronElectoralOnpes;
		this.ubigeos = ubigeos;
	}

	// Property accessors
	@Id
	@Column(name = "UBIGEO", unique = true, nullable = false, insertable = true, updatable = true)
	public String getUbigeo() {
		return this.ubigeo;
	}

	public void setUbigeo(String ubigeo) {
		this.ubigeo = ubigeo;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "UBIGEOPADRE", unique = false, nullable = true, insertable = true, updatable = true)
	public Ubigeo getUbigeoPadre() {
		return this.ubigeoPadre;
	}

	public void setUbigeoPadre(Ubigeo ubigeoPadre) {
		this.ubigeoPadre = ubigeoPadre;
	}

	@Column(name = "DESCRIPCION", unique = false, nullable = true, insertable = true, updatable = true)
	public String getDescripcion() {
		return this.descripcion;
	}

	public void setDescripcion(String descripcion) {
		this.descripcion = descripcion;
	}

	@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "ubigeo")
	public Set<RegistroLinea> getRegistroLineas() {
		return this.registroLineas;
	}

	public void setRegistroLineas(Set<RegistroLinea> registroLineas) {
		this.registroLineas = registroLineas;
	}

	@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "ubigeo")
	public Set<PadronElectoralOnpe> getPadronElectoralOnpes() {
		return this.padronElectoralOnpes;
	}

	public void setPadronElectoralOnpes(
			Set<PadronElectoralOnpe> padronElectoralOnpes) {
		this.padronElectoralOnpes = padronElectoralOnpes;
	}

	@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "ubigeoPadre")
	public Set<Ubigeo> getUbigeos() {
		return this.ubigeos;
	}

	public void setUbigeos(Set<Ubigeo> ubigeos) {
		this.ubigeos = ubigeos;
	}

}